<extend name="work/base" />
<block name="content">
        <form class="layui-form inline-form">
            <div class="pull-left">
                <div class="layui-inline">
                    <button class="layui-btn layui-btn-normal layui-btn-sm ajax-form" data-url="{:url('add')}"><i class="layui-icon">&#xe61f;</i> 新增</button>
                </div>
            </div>
            <div class="pull-right">
                <div class="layui-inline">
                    <input class="layui-input" name="keyword" placeholder="输入关键词搜索">
                </div>
                <div class="layui-inline">
                    <select name="group" lay-filter="data-list">
                        <option value="">全部分组</option>
                        <volist name="group" id="vo">
                            <option value="{$key}">{$vo}</option>
                        </volist>
                    </select>
                </div>
                <div class="layui-inline">
                    <button class="layui-btn search  layui-btn-normal  layui-btn-sm "><i class="layui-icon">&#xe615;</i></button>
                </div>
            </div>
        </form>
        <table class="layui-table text-center" id="list" lay-filter="list" list-url="{:url('lists')}" edit-url="{:url('edit')}"  del-url="{:url('delete')}"></table>

</block>
<block name="script">
    <script type="text/html" id="barDemo">
        <a class="layui-btn layui-btn-xs layui-btn-normal " lay-event="edit">编辑</a>
        <a class="layui-btn layui-btn-xs layui-btn-primary " lay-event="delete" >删除</a>
    </script>
    <script type="text/html" id="status">
        <input type="checkbox" name="lock" value="{{d.id}}" lay-skin="switch" lay-text="是|否" lay-filter="is_view" {{ d.lock ==1?'checked' : '' }}>

    </script>
    <script type="text/javascript">
        layui.use([ 'element', 'table'], function(){
            var table = layui.table;
            table.render({
                elem: '#list'
                ,url:"{:Url('lists')}"
                ,toolbar: '<div></div>'
                ,page:false
                ,loading:true
                ,title:''
                ,limit:20
                ,defaultToolbar: ['filter', 'print', 'exports']
                ,cols: [[
                    {field:'id', width:80, title: '#'}
                    ,{field:'title',  title: '标题'}
                    ,{field:'name',  title: '名称'}
                    ,{field:'type', width:80, title: '类型'}
                    ,{field:'group', width:130, title: '分组'}
                    ,{field:'update_time', width:180, title: '更新时间'}
                    ,{field:'sort', width:90, title: '排序',edit:'text'}
                    ,{field:'lock', width:120, title: '锁定', templet:'#status'}
                    ,{field:'info', width:110,title: '操作详情',toolbar: '#barDemo'}
                ]]
            });
        });
    </script>
</block>